/**
 * Copyright 2007 Igor Chaves Cananéa
 *
 * This file is part of PBSFW
 *
 * PBSFW is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * PBSFW is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef _REPORTER_H_
#define _REPORTER_H_

#include <cstdio>
#include <string>
#include <vector>
#include "defines.h"
#include "property.h"
#include "resetable.h"
#include "process.h"
using namespace std;

namespace pbsfw {
    class Reporter : public Process, public Resetable {
        private:
            simtime_t interval;
            vector<string> &propertyNames;
            PropertyTable &properties;
            bool firstTime;

        protected:
            FILE *output;
            virtual void do_queryProperties(PropertyItem) = 0;

        public:
            Reporter(FILE *output, simtime_t interval);
            virtual ~Reporter() {
            		this->propertyNames.clear();
            		this->properties.clear();
            		delete &this->propertyNames;
            		delete &this->properties;
            }

            void addPropertyName(const char *name) {
                this->propertyNames.push_back(name);
            }

            simtime_t getInterval() const {
                return this->interval;
            }

            void run();

            virtual void reset() {}
            virtual void simulationEnd() {}

    };
};

#endif
